package com.szt.ynb.server.router.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import com.szt.ynb.server.router.entity.enums.LogType;

@Entity
public class Log implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -1370949915835109351L;
	
	@Id
	@GeneratedValue
	private Long id;
	
	@Column(nullable = true)
	private Long userId;
	
	@Column(nullable = false)
	private Date addDate;
	
	@Column(nullable = false)
	private String mes;
	
	/** 日志类型 */
	@Column(nullable = false)
	@Enumerated(EnumType.ORDINAL)
	private LogType logType;
	
	@Column(nullable = false)
	private String ip;
	
	public Log() {
		
	}
	
	public Log(Long userId, String mes, LogType logType, String ip) {
		super();
		this.userId = userId;
		this.addDate = new Date();
		this.mes = mes;
		this.setLogType(logType);
		this.ip = ip;
	}
	
	public Long getId() {
		return id;
	}
	
	public void setId(Long id) {
		this.id = id;
	}
	
	public Date getAddDate() {
		return addDate;
	}
	
	public void setAddDate(Date addDate) {
		this.addDate = addDate;
	}
	
	public String getMes() {
		return mes;
	}
	
	public void setMes(String mes) {
		this.mes = mes;
	}
	
	public Long getUserId() {
		return userId;
	}
	
	public void setUserId(Long userId) {
		this.userId = userId;
	}
	
	public String getIp() {
		return ip;
	}
	
	public void setIp(String ip) {
		this.ip = ip;
	}
	
	public LogType getLogType() {
		return logType;
	}
	
	public void setLogType(LogType logType) {
		this.logType = logType;
	}
	
}
